package com.lvyou.model;

import com.fasterxml.jackson.annotation.JsonInclude;

//当成员为空时，将该类转换成json数据，就不转换该成员变量
@JsonInclude(JsonInclude.Include.NON_NULL)
public class JsonResult<T> {

	/**
	 * code: 
	 * 		0：表示成功
	 * 	    1：表示操作失败
	 *
	 * 		100: 表示注册失败
	 * 		101：电话号重复
	 * 		102: 用户名为空
	 * 		103：密码为空
	 *
	 * 		200:登录失败
	 * 		300:需要登录
	 * 
	 * 		100000:发生错误
	 */
	protected int code;
	protected String msg;
	protected T data;
	
	public JsonResult() {
		
	}
	public JsonResult(int code,String msg){
		this.code=code;
		this.msg=msg;
	}
	public JsonResult(int code,T data){
		this.code=code;
		this.data=data;
	}
	public JsonResult(int code,String msg,T data){
		this.code=code;
		this.msg=msg;
		this.data=data;
	}
	
	public int getCode() {
		return code;
	}
	public void setCode(int code) {
		this.code = code;
	}
	public String getMsg() {
		return msg;
	}
	public void setMsg(String msg) {
		this.msg = msg;
	}
	public T getData() {
		return data;
	}
	public void setData(T data) {
		this.data = data;
	}
	
}
